Segregational instability of multicopy plasmids: A population genetics approach

Abstract Plasmids are extra‐chromosomal genetic elements that encode a wide variety of phenotypes and can be maintained in bacterial populations through vertical and horizontal transmission, thus increasing bacterial adaptation to hostile environmental conditions like those imposed by antimicrobial substances. To circumvent the segregational instability resulting from randomly distributing plasmids between daughter cells upon division, nontransmissible plasmids tend to be carried in multiple copies per cell, with the added benefit of exhibiting increased gene dosage and resistance levels. But carrying multiple copies also results in a high metabolic burden to the bacterial host, therefore reducing the overall fitness of the population. This trade‐off poses an existential question for plasmids: What is the optimal plasmid copy number? In this manuscript, we address this question by postulating and analyzing a population genetics model to evaluate the interaction between selective pressure, the number of plasmid copies carried by each cell, and the metabolic burden associated with plasmid bearing in the absence of selection for plasmid‐encoded traits. Parameter values of the model were estimated experimentally using Escherichia coli K12 carrying a multicopy plasmid encoding for a fluorescent protein and bla TEM‐1, a gene conferring resistance to β‐lactam antibiotics. By numerically determining the optimal plasmid copy number for constant and fluctuating selection regimes, we show that plasmid copy number is a highly optimized evolutionary trait that depends on the rate of environmental fluctuation and balances the benefit between increased stability in the absence of selection with the burden associated with carrying multiple copies of the plasmid.


| INTRODUC TI ON
Prokaryotes transfer DNA at high rates within microbial communities through mobile genetic elements such as bacteriophages (Chen et al., 2018), transposons (Chen & Dubnau, 2004), or extrachromosomal DNA molecules known as plasmids (Funnell & Phillips, 2004). Crucially, plasmids have core genes that allow them to replicate independently of the chromosome but also encode for accessory genes that provide their bacterial hosts with new functions and increased fitness in novel or stressful environmental conditions (Groisman & Ochman, 1996). Plasmids have been widely studied due to their biotechnological potential (Alonso & Tolmasky, 2020) and their relevance in agricultural processes (Pemberton & Don, 1981), but also because of their importance in clinical practice since they have been identified as significant factors contributing to the current global health crisis generated by drug-resistant bacterial pathogens (San Millan, 2018).
Although the distribution of plasmid fitness effects is variable and context dependant (Alonso-del Valle et al., 2021), it is generally assumed that in the absence of selection for plasmid-encoded genes, plasmids impose a fitness burden on their bacterial hosts (Baltrus, 2013;San Millan & Maclean, 2017). As a result, plasmidbearing populations can have a competitive disadvantage compared with plasmid-free cells, thus threatening plasmids to be cleared from the population through purifying selection (Vogwill & MacLean, 2015). To avoid extinction, some plasmids can transfer horizontally to lineages with increased fitness, with previous theoretical results establishing sufficient conditions for plasmid maintenance, namely that the rate of horizontal transmission has to be larger than the combined effect of segregational loss and fitness cost (Bergstrom et al., 2000;Stewart & Levin, 1977). Also, some plasmids encode molecular mechanisms that increase their stability in the population, for instance, toxin-antitoxin systems that kill plasmid-free cells (Mochizuki et al., 2006), or active partitioning mechanisms that ensure the symmetric segregation of plasmids upon division (Salje, 2010).
To avoid segregational loss, nonconjugative plasmids lacking active partitioning and postsegregational killing mechanisms tend to be present in many copies per cell, therefore decreasing the probability of producing a plasmid-free cell when randomly segregating plasmids during cell division. But this reduced rate of segregational loss is not sufficient to explain the stable persistence of costly plasmids in the population, suggesting that a necessary condition for plasmids to persist in the population is to carry beneficial genes for their hosts that are selected for in the current environment. However, regimes that positively select for plasmid-encoded genes can be sporadic and highly specific, so plasmid persistence is not guaranteed in the long term. Moreover, even if a plasmid carries useful genes for the host, these can be captured by the chromosome, thus making plasmids redundant and rendering them susceptible to be cleared from the population (Hall et al., 2016).
In this paper, we use a population genetics modeling approach to evaluate the interaction between the number of plasmid copies contained in each cell and the energetic cost associated with carrying each plasmid copy. We consider a nontransmissible, multicopy plasmid (it can only be transmitted vertically) that lacks active partitioning or postsegregational killing mechanisms (plasmids segregate randomly upon division). We will also consider that plasmids encode a gene that increases the probability of survival to an otherwise lethal concentration of an antimicrobial substance, albeit imposing a burden to plasmid-bearing cells in drug-free environments. To estimate parameters of our population genetics model, we used an experimental model system consisting on Escherichia coli bearing a multicopy plasmid pBGT (~19 copies per cell) carrying bla TEM-1 , a drug resistance gene that produces a β-lactamase that degrades ampicillin and other β-lactam antibiotics (Salverda et al., 2010;San Millan, 2018).
We used computer simulations to evaluate the stability of a multicopy plasmid in terms of the duration and strength of selection in favor of plasmid-encoded genes. This allowed us to numerically estimate the number of copies that maximized plasmid stability under different environmental regimes: drug-free environments, constant exposure to a lethal drug concentration, and intermittent periods of selection. Altogether, our results confirm the existence of two opposing evolutionary forces acting on the number of copies carried by each cell: selection against high-copy plasmids consequence of the fitness cost associated with bearing multiple copies of a costly plasmid and purifying selection resulting from the increased probability of plasmid loss observed in low-copy plasmids.

| Serial dilution protocol
We consider a serial dilution experiment with two types of bacteria: plasmid-bearing (PB) and plasmid-free (PF). Let us denote by n the plasmid copy number (PCN) and argue that this is an important parameter: in the one hand, the selective disadvantage of PB individuals due to the cost of carrying plasmids is assumed to be proportional to n; on the other hand, the PCN determines the heritability of the plasmid.
In our schema, each day starts with a population of N cells that grow exponentially until saturation is reached (i.e., until there are γN cells). At the beginning of the next day, N cells are sampled (at random) and transferred to new media and exponential growth starts again ( Figure 1a).

| Interday dynamics
To model the interday dynamics, we consider a discrete-time model in which the population size is fixed to N. Day i starts with a fraction X i of PB cells (and 1 − X i of PF cells). We consider that the fitness cost associated with plasmid maintenance; κ n is proportional to the PCN, that is, κ n = κn. This means that, at the end of day i, the number of PF cells is proportional to their initial frequency 1 − X i , while the number of PB cells is proportional to their initial frequency X i multiplied by (1 − κ n ) < 1. So, at the end of day i, the fraction of PB cells would be In addition, PB cells can lose their plasmids and become PF and with probability μ n , so, at the end of day i, the fraction of PB cells needs to be multiplied by (1 − μ n ).
At the beginning of day i + 1, we sample N individuals at random from the previous generation. Since N is very large, we can neglect stochasticity and assume that the fraction of PB cells at the beginning of day i + 1 is equal to their fraction at the end of day i, that is, Additionally, we aim to modeling selection for plasmid-encoded genes. For plasmids carrying antibiotic resistance genes, this is achieved by exposing the population to antibiotic pulses. Individuals with no plasmids suffer more from this treatment, so, at each pulse, we observe an increment in the relative frequency of the PB subpopulation. To model this phenomenon, we assume that, in the presence of antibiotic, PF individuals exhibit a selective disadvantage represented by parameter α ∈ [0,1].
For instance, if an antibiotic pulse occurs at day i, all PB cells survive, (there are NX i ), but the PF cells die with probability α, so only N(1 − α)(1 − X i ) survive. So, the fraction of PB individuals, right after the antibiotic pulse becomes Then, cells grow exponentially again, as in a normal day, so that, at the end of the day, the fraction of PB cells is f(g[X i ]).
If we consider that the pulses occur at generations T, 2T,…, the frequency process becomes

| Intraday dynamics
For the intraday dynamics, day i starts with a population of N cells (N ∼ 10 5 in the experiment) that grow exponentially until saturation is reached (i.e., until there are γN cells). The initial fraction of PB cells is X i . We assume that, in the absence of antibiotic, the population evolves as a continuous time multitype branching process is the number of PB cells (resp. PF cells). The reproduction rate (or Malthusian fitness) of PB (resp. PF) individuals is r (resp. r + ρ n ), with ρ n > 0 (since PB individuals have some disadvantage due to the cost of plasmid maintenance).
We consider plasmids that lack active partitioning systems (Salje, 2010), so, at the moment of cell division, each plasmid randomly segregates into one of the two new cells. Once in the new host, the plasmids replicate until reaching n copies. If, however, one of the two new cells has all the n copies, the other one will not carry any plasmid copy and becomes PF. Thus, we make the simplifying assumption that the daughter of a PB cell becomes PF with probability 2 −n (segregational loss rate), as illustrated in Figure 1b. Therefore, at every branching event, an individual splits in two. Plasmid-free individuals only split in two PF individuals.
Plasmid-bearing individuals can split in one PF individual and one (2) PB individual with probability 2 −n (if all the plasmids go to one of them) or they can split in two plasmid-bearing individuals with probability 1-2 −n .
Let M(t) = {M i,j (t): i,j = 0,1} be the mean matrix given by M i,j (t) = e i Z j t , the average size of the type j population at time t if we start with a type i individual. According to (Athreya & Ney, 2004;section V.7.2), M(t) can be calculated as an exponential matrix More precisely, Let σ be the duration of the growth phase. Since N is very large, one can assume that reproduction is stopped when the expectation of the number of descendants reaches γN, that is, that σ satisfies Since n ∼ N −b , we have for large enough N that Since γN >> 1, we can assume that the number of PB (resp. PF) cells at the end of the day is equal to its expected value. Therefore, the fraction of PB cells at the end of day i is equal to This corresponds to Equation (2) with parameters The importance of these formulas is that they connect measurable quantities with theoretical parameters, leading to a method to estimate the parameters of the model from experiments, which is the spirit of the experiment described in the following section.

| Model parametrization
Our goal is to use the interday model to evaluate the long-term dynamics of plasmid-bearing populations in terms of the cost associated with carrying plasmids and the fitness advantage conferred by the plasmid in the presence of positive selection. To quantify these parameters experimentally, our approach consisted in two phases: (1) from growth kinetic experiments, we estimate parameters ρ, r, and σ of the interday model, and (2) we perform competition experiments in a range of drug concentrations to obtain μ n and κ n using Equation (4) of the intraday model. Our experimental model system consisted in E. coli K12 carrying pBGT, a nontransmissible multicopy plasmid used previously to study plasmid dynamics and drug resistance evolution (Hernandez-Beltran (3) (4) n = n 1 − e −(r2 −n + n ) r2 −n + n ∼ n = n and n = 1 − r2 −n + n r2 −n e (r2 −n + n ) + n ∼ n→∞ r 2 −n .
F I G U R E 2 Growth kinetic experiment. (a) Schematic diagram illustrating a bacterial growth experiment performed in drug-free media separately for PB and PF populations. We used an absorbance microplate reader to measure the optical density (OD 630 ) at different timepoints during the 24-h experiment. (b) Growth curves of PB (green) and PF (black) strains, with replicate experiments represented as shaded curves. The duration of the exponential phase, σ, was estimated by identifying the start of exponential phase and the time elapsed before reaching carrying capacity. Parameter ρ refers to the maximum growth rate of the PB population, while the selective advantage of the PF strain is represented with r.

hours
Absorbance reader  , 2020Rodriguez-Beltran et al., 2018;San Millan et al., 2016). Briefly, pBGT is a ColE1-like plasmid with ~19 plasmid copies per cell, lacking the necessary machinery to perform conjugation or to ensure symmetric segregation of plasmids upon division.
This plasmid carries a GFP reporter under an arabinose-inducible promoter and the bla TEM-1 gene that encodes for a β-lactamase that efficiently degrades β-lactam antibiotics, particularly ampicillin (AMP). The minimum inhibitory concentration (MIC) of PB cells to AMP is 8192 mg/L, while the PF strain has a MIC of 4 mg/L (see Growth experiments were performed in 96-well plates with lysogeny broth (LB) rich media and under controlled environmental conditions. Using a plate absorbance spectrophotometer, we obtained bacterial growth curves that enabled us to estimate the maximal growth rate of the PB and PF strains, corresponding to r and ρ n in the intraday model (Hall et al., 2014; Figure 2a and Appendix C). As expected, we observed a reduction in bacterial fitness of the PB subpopulation, expressed in terms of a decrease in its maximum growth rate when grown in isolation. The metabolic burden associated with carrying the pBGT plasmid (n = 19) was estimated at 0.108 ± 0.067 ( Figure 2b).
We then performed a 1-day competition experiment consisting of mixing PB and PF subpopulations with a range of relative abundances and exposing the mixed populations to environments with increasing drug concentrations (see Figure 3a for a schematic of the experimental protocol). Previous studies have used a similar approach to determine a selection coefficient (Dykhuizen, 1990), a quantity that was used to show that selection of resistance can occur even at sublethal antibiotic concentrations (Gullberg et al., 2011).

F I G U R E 3
Competition experiment under a range of drug concentrations. (a) Schematic diagram illustrating an experiment where PB and PF are mixed at different relative abundances and submitted to a range of ampicillin concentrations (0, 1, 2, 2.5, 3, 3.5, 4, and 6 μg/ml). We use a fluorescence spectrophotometer to estimate the relative abundance of plasmid-bearing cells in the population after 24 h of growth. (b) Final PF frequency (illustrated in a gradient of green) for different initial fraction of PB cells and selection coefficients (top: Data; bottom: Model). (c) Control experiment illustrating that normalized fluorescence intensity is correlated with the fraction of the population carrying plasmids. Each dot presents a replica and the dotted line a linear regression (R 2 = .995). (d) Experimental iterative map showing the existence of a minimum drug concentration that rescues the PB population (red lines). At low drug concentrations (blue lines), the PB population decreases in frequency. (e) Theoretical iterative map obtained by numerically solving Equation (2) for a range of strength of selections and initial PB frequencies. By fixing κ n (previously estimated by growing each strain in monoculture), we fitted parameter α in Equation (2) to the experimental data. Colors indicate the strength of selection (in blue), values of α where the cost of carrying plasmids is stronger than the benefit resulting from positive selection, yielding curves below the identity line. Red curves represent simulations obtained with values of α strong enough to kill PF cells, thus increasing PB frequency in the population.  Figure 3d shows the end-point bacterial density resulting from competition experiments with different initial fractions of PB cells exposed to a range of AMP concentrations. Note that, at low AMP concentrations (blue lines), the frequency of plasmid bearing is below the identity, consistent with plasmids imposing a fitness cost to PB cells. By contrast, at high AMP concentrations (red lines), plasmid-free cells are killed and the population is almost exclusively conformed by PB cells.
In the model, since PCN is a fixed parameter, the PB fraction resulting from a competition experiment in the absence of selection only depends on the cost associated with plasmid bearing. Therefore, by fitting Equation (1), we estimated that the cost associated with carrying n = 19 copies of pBGT was κ n = 0.272. Furthermore, by fixing this parameter and incorporating antibiotics, we estimated the selective pressure α for different antibiotic concentrations by fitting Equation (2) to the experimental data. Figure 3e illustrates that at low antibiotic concentrations (small values of α) the frequency of the population is low, while higher values of α result in an increased PB frequency. Table 1 summarizes parameter values estimated for each strain in our model, and Table 2 shows the correspondence between antibiotic concentrations and α.

| Segregational instability in the absence of selection
Our first aim was to evaluate the stability of a costly multicopy plasmid in the absence of selection for plasmid-encoded genes (i.e., without antibiotics). By numerically solving Equation (1), we evaluated the stability of the PB subpopulation in terms of the mean PCN and the fitness cost associated with carrying each plasmid copy (see Appendix C). As expected, in the absence of selection, plasmids are always cleared from the population with a decay rate that depends on PCN. We define the time-to-extinction as the time when the fraction of PB cells goes below an arbitrary threshold.
For cost-free plasmids (i.e., when κ = 0), the time-to-extinction appears to be correlated to PCN (Figure 4a). By contrast, if we consider a costly plasmid (κ > 0) and that the total fitness cost is pro-

| Evaluating the role of selection in the stability of plasmids
To study the interaction between plasmid stability and the strength of selection in favor of PB cells, we assumed that the plasmid carries a gene that confers a selective advantage to the host in specific environments (e.g., resistance to heavy metals or antibiotics). For the purpose of this study, we will consider a bactericidal antibiotic (e.g., ampicillin) that kills PF cells with a probability that depends on the antibiotic dose. This results in a competitive advantage of the PB cells with respect to the PF subpopulation in this environment. We denote the intensity of this selective pressure by α. ) and drug always present in the environment (T = 1). In our model, then we found a critical dose that stabilizes plasmids in the population, that is, the minimum selective α, MSα = κ n + μ n (1 − κ n ; see Appendix B). The existence of a minimum selective concentration (MSC) that maintains plasmids in the population is a feature used routinely by bioengineers to stabilize plasmid vectors through selective media (Kumar et al., 1991). Recall that in our model the PF MIC is α = 1; therefore, the MSα can be directly compared with the MSC/MIC ratio previously proposed (Greenfield et al., 2018;Gullberg et al., 2011) as a concern factor on the selection of resistant strains in the environment.
As illustrated in Figure 5h, both low-copy and high-copy plasmids are inherently unstable and therefore the selective pressure necessary to stabilize them is relatively high, particularly for costly plasmids. Interestingly, at intermediate PCN values, the selective conditions necessary to stabilize plasmids are considerably less stringent than for low-and high-copy plasmids. This is the result of the nonlinear relationship between MSα and n; since μ n decreases exponentially with n, κ n increases only linearly with n.

| Plasmid stability in periodic environments
The purpose of this section is to understand the ecological dynamics of the plasmid-bearing population in fluctuating environments, that is, when periodic antibiotic pulses are administered. We started by

F I G U R E 4
Numerical results for the model without selection for plasmid-encoded genes. (a) Plasmid frequency as a function of time for a cost-free plasmid (κ = 0). Note how, as the PCN increases, the stability of plasmids also increases, although eventually all plasmids will be cleared from the system. (b) Dynamics of plasmid loss for strains bearing a costly plasmid (κ = 0.0143). In this case, low-copy plasmids (light blue lines) are highly unstable, but so are high-copy plasmids (dark blue lines). (c) Time elapsed before plasmid extinction for a range of PCNs. A very costly plasmid (κ = 5%) is represented in dark purple, while the light purple line denotes a less costly plasmid (κ = 0.5%). (d) Plasmid stability for a range of fitness costs and PCNs (discrete colormap indicates level of stability, yellow denotes higher stability, while dark purple denotes rapid extinction). Stability is measured as the area under the curve (AUC) of trajectories similar to those in (b), expressed in log 10 scale. Notice that, for intermediate fitness costs, the PCN that maximizes plasmid stability can be found at intermediate values. Consistently with the results from the first section, lower plasmid costs result in increased rescue times, suggesting that a lesser rate of antibiotic exposure is required for their maintenance. In Figure 6b, we quantified this minimal period as a function of PCN and α. Note that higher values of α correspond to longer periods, which follows from the fact that a higher selective pressure increases the PB frequency. Figure 6d illustrates this critical period for PCN = 19.
In periodic environments, the relative abundance of the PB population is driven to zero (extinction) or reaches a steady state in which the plasmid fraction oscillates around an equilibrium frequency (persistence). In Figure 6c, times to stabilization were estimated for the strong selection regime (α = 0.99), using the same PCNs as in Figure 5i. Notice that the time-to-extinction is larger than the time to reach the periodic attractor. In both cases, the maximal time to rescue and the minimum period to avoid loss, we observe a nonmonotone effect of PCN and, therefore, a range of PCNs whereby plasmid stability is maximized. This is consistent with what we observed without antibiotics ( Figure 4c) and with constant environments (Figure 5h).

| Optimal PCN depends on the rate of environmental fluctuation
In this section, we aim at exploring the concept of optimal PCN and how it depends on the environment. To do so, we define the optimal PCN (hereafter denoted PCN*) as the PCN that maximizes the area under the curve (AUC) of the PB frequency over time. This notion of stability was already introduced in Figure 4d and has the advantage that it can be used when the PB fraction goes to 0, to a fixed equilibrium, or when it oscillates.
First, we calculated PCN* for a range of plasmid fitness costs in the absence of selection (black solid line of Figure 7a) and found that PCN* is inversely correlated with the plasmid fitness cost. In order to compare the optimal PCN predicted by the model with PCN values found in other experimental plasmid-host associations, we searched the literature for studies that measure both PCN and fitness cost. These values are summarized in Table 3 and illustrated in   Figure 7c).

F I G U R E 6
Numerical results of the model in periodic environments. (a) Maximum time a plasmid population can grow without antibiotics to avoid plasmid loss when applying a strong antibiotic pulse. Curves represent how this time is affected by PCN. Blue intensity represents plasmid cost, and black line indicates results using the pBGT parameters. (b) Minimal period required to avoid plasmid extinction. Simulations were performed using the pBGT measured cost (κ = 0.014). Red intensity represents different values of α. Note that higher values of α increase the minimal period. (c) Time required for trajectories to stabilize for copy numbers 5, 19, and 30 using α = 0.99 and the measured cost per plasmid. Note that there is a critical period that defines fixation or coexistence marked by red and blue circles on the PCN = 19 (black) curve. (d) Trajectories for the critical periods of PCN = 19 starting from 0.5 PB-PF frequency. Note that 1-day period difference leads to opposite outcomes.

| DISCUSS ION
In this work, we used a population genetics modeling approach to study how nontransmissible plasmids are maintained in bacterial populations exposed to different selection regimes. In particular, we considered a small multicopy plasmid that lacks an active partitioning mechanism and therefore segregates randomly upon cell Observe that for very short periods optimal PCNs are high, then for certain period the optimal PCN reaches a minimum then as period increases, the optimal PCN tends to the optimal of α = 0. (c-e) Optimal PCNs using random environments.
(c) Environments are classified by their rate of days with antibiotics, the rate differences produce a multimodal outcome, where higher rates increase the optimal PCN and vice versa. Simulations using the same environments were made for different αs. Note that α intensity increases the separation of the modes. antibiotics. Using this approach, we obtained theoretical and experimental iterative maps that we used to predict the long-term dynamics of the system.
Altogether, our results suggest that plasmid population dynamics in bacterial populations is predominantly driven by the existence of a trade-off between segregational loss and plasmid cost. We found that selection is necessary for the persistence of costly plasmids in the long term and that the strength of selection is highly correlated with the final fraction of plasmids in the entire population.
As a result, whether plasmids are maintained or lost in the long term results from the complex interplay between PCN and its fitness cost, as well as the intensity and frequency of positive selection.
As shown in the exhaustive exploration of parameters performed in this study, these relationships are highly nonlinear, thus resulting in the existence of an optimal PCN that depends on the rate of environmental fluctuation, the number of plasmids carried in each cell, and the fitness burden conferred by each plasmid-encoded gene in the absence of selection. In random environments, we observed a bimodal PCN* distribution, similar to the plasmid size distribution described for nontransmissible plasmids (Smillie et al., 2010) and for conjugative plasmids (Ledda & Ferretti, 2014).
Although both our theoretical and experimental models consider a multicopy plasmid with random segregation, the existence of an optimal PCN should also hold for nonrandom segregation (e.g., active partitioning), as this would decrease the probability of segregational loss (which corresponds to having a smaller value of μ n in our model) so its optimal copy number will likely be lower than a plasmid that relies on random segregation (Lopez et al., 2021). By contrast, compensatory adaptation that reduces the fitness cost associated with plasmid bearing (in our model, a lower value of κ n ), would result in an increase in PCN*. We conclude by arguing that, as the existence of plasmids in natural environments requires intermittent periods of positive selection, the presence of plasmids contains information on the environment in which a population has evolved. Indeed, the plasmid copy number associates the frequency of selection with the energetic costs of plasmid maintenance. That is, there is a minimum frequency of drug exposure that allows multiple copies to persist in the population, and, for each environmental regime, there is an optimal number of plasmid copies.  writing -review and editing (equal).

ACK N OWLED G EM ENTS
We

O PEN R E S E A RCH BA D G E S
This article has earned Open Data and Open Materials badges.

DATA AVA I L A B I L I T Y S TAT E M E N T
The data and code underlying this article are available at: https://doi. org/10.5281/zenodo.6360056.

A PPEN D I X A
Experimental methods

BAC TER I A L S TR A I N S A N D M ED I A
The plasmid-free strain we used was E. coli K12 MG1655 and the plasmid-bearing strain was MG/pBGT carrying the multicopy plas-

BAC TER I A L G ROW TH E XPER I M ENTS
Growth kinetics measurements of each strain were performed in 96-well plates with 200 μl of LB with 0.5% w/v arabinose without antibiotics, plates were sealed using X-Pierce film (Sigma Z722529), and each well seal film was pierced in the middle with a sterile needle to avoid condensation. Plates were grown at 37°C, and readings for OD and fluorescence were made every 20 min in a fluorescence microplate reader (BioTek Synergy H1), after 30-s linear shaking.

CO M PE TITI O N E XPER I M ENTS
Competition experiments were performed using 96-well plates with 200 μl of LB with 0.5% w/v arabinose, and respective ampicillin concentrations: 0, 1, 2, 2.5, 3, 3.5, 4, and 6 mg/L were implemented by plate rows. To construct our inoculation plate, overnight cultures of the plasmid-free strain and the plasmid-bearing strain were adjusted to an OD of 1 (630 nm) using a BioTek ELx808 Absorbance using OD (630 nm) and eGFP (479,520 nm) after 1 min of linear shaking.

PL A S M I D FR AC TI O N D E TER M I N ATI O N
To calculate the fluorescence intensity, we first subtracted the background signal of LB for fluorescence and OD, respectively, and then the debackgrounded the fluorescence signal was scaled by dividing by the debackgrounded OD. The measurements for our inoculation plate showed a strong linear correlation (R 2 = .995) between co-cultures fractions and fluorescence intensity (Figure 3b). This allowed to directly approximate the population's plasmid fractions from the readings of our competition experiments. We normalized the data independently for each antibiotic concentration taking the average measurements of the four replicates. Plasmid fractions, PF, were inferred by normalizing the mean fluorescence intensity for each well, f i , to the interval [0,1] using the following formula: were f max and f min are the mean fluorescence intensities at fractions 1 and 0, respectively.

A PPEN D I X B
Mathematical model

FIXED P O I NTS O F EQ UAT I O N (2 )
Let f = f • g. We want to study the fixed points of f and their domains of attraction. It is not hard to see that 0 is always fixed point, and once the frequency reaches 0, it stays at 0. In addition, if x ≠ 0, Since the frequencies are in [0,1], this fixed point only exists if α > κ n + μ n (1 − κ n ). As n increases, μ n decreases exponentially, while κ n increases only linearly, so there is a nonlinear relationship between n and the minimum α required for the existence of a second fixed point x*.
Let us analyze the stability of x*. Let us assume that α > κ n + μ n (1 − κ n ).
So, the frequency increases if it is below x* and decreases otherwise, meaning that it is a stable fixed point. In addition, the domain of attraction is (0,1], meaning that this equilibrium fraction is reached for any initial state. To sum up, 0 is always a fixed point. If α > κ n + μ n (1 − κ n ), then there is an additional stable fixed points x*.

CH O I CE O F TH E M O D EL
In this section, we compare two types of mathematical models for the evolution of plasmid-bearing frequencies, the discretetime model used in this paper (Equation (2)) and the Wright-Fisher diffusion.
There had been several attempts to adapt the classical theory of Wright-Fisher models to this experimental setting (see for example (Chevin, 2011) a heuristic and applicable to data framework was introduced.
Recently, in Baake et al. (2019), the two methodologies had been paired in order to have a rigorous and applicable way to use classic population genetics to study evolutionary experiments. In this work, days take the role of generations, and as the number of individuals after each sampling is more or less constant, the assumption of constant population size becomes reasonable.
Let us assume that the mutation rate N,n = 2 −n and the cost κ N,n are parameterized by N. To see the accumulated effects of plasmid costs, segregational loss, and genetic drift, we need κ N,n and μ N,n to be of order 1∕N (see, e.g., Chapter 5 in Etheridge, 2011). The first condition is fulfilled if the cost per plasmid is very low, for example, when κ N,n = κn∕N. The second one stands if n is of order log 2 (N), where B is a standard Brownian motion. This is known as the Wright-Fisher diffusion with mutation and selection. When antibiotic is added, at times {T,2T,…}, then (5) modifies to However, in our experimental setting, the cost that we measure ( n ≃ 0.27) is much higher than the inverse population size, so we are in the regime of strong selection. In other words, for plasmids that have a very small cost, of the order of 1∕N, genetic drift would play an important role, and the above Wright-Fisher diffusion with mutation, selection and antibiotic peaks (6) would be the most suitable model. But in our setting, selection (plasmid costs) is so high that genetic drift becomes negligible. Recall that Equation (2)

CO M PUTER I M PLEM ENTATI O N
The model was implemented in Python, using standard scientific computing libraries (Numpy, MatplotLib, and the Decimal library were required to resolve small numbers conflicts). In general, all simulations started at PB frequency 1 (unless stated otherwise). Numeric simulations were defined to reach a steady state when values first repeat.
In the case of periodic environments, the repetition must happen at antibiotic peak days. We considered extinction if the end point of the realization dropped below a threshold adjusted to the simulations times, the highest being 1 × 10 −7 and the lowest 1 × 10 −100 .

R A N D O M EN V I RO N M ENTS
Environmental sequences of size 1000 (days) using a binomial distribution varying the probability of success. For each environment created, we also bit-flipped (so 101… turns into 010…) and two measures were applied to each resulting environment. First, we used Shannon entropy, H(Env) = − ∑ n i p i log n � p i � , with two states, n = 2 (antibiotic or no-antibiotic) and p i equal to the probability of finding a state day, that is, the fractions of days with antibiotics and without antibiotics. We classified environments by their H and by the fraction of antibiotic days, as being this an important feature.
These two measures are in the [0,1] interval, so we binned the intervals into 20 bins and 1000 environments were created for each bin.

M O D EL PA R A M E TR IZ ATI O N
Growth kinetics parameters were estimated using the R (R Core Team, 2020) package growth rates (Petzoldt, 2019). Exponential phase duration, σ, was calculated by finding lag phase duration and the time to reach carrying capacity using the nonlinear growth model Baranyi. Maximum growth rates, r and r + ρ n , were estimated using the nonparametric smoothing splines method. κ n value was estimated using Equation (1) and the data from the antibiotic-free competition experiment using a curve fitting algorithm from the SciPy library in a custom Python script. Respective values of α were found in the same manner using Equation (2) and fixing κ n . κ n was also calculated using the formula in Equation (4) with a very similar result. The parameters are summarized in Tables 1 and 2.